package fr.fort.lycee.spring.daoImpl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import fr.fort.lycee.spring.dao.IDaoRole;
import fr.fort.lycee.spring.entities.Role;
@Repository
@Transactional
public class DaoRoleImpl implements IDaoRole{

	@PersistenceContext
	private EntityManager em;
	
	public Integer save(Role role) {
		em.persist(role);
		return role.getIdRole();
	}

	public void update(Role role) {
		em.merge(role);
	}

	public void delete(Role role) {
		em.remove(role);
	}

	public Role findById(int id) {
		Role retour=em.find(Role.class, id);
		return retour;
	}
@Override
public List<Role> findAll() {
	// TODO Auto-generated method stub
	return null;
}
}
